const connection = require('../app/database.js')
// 所有和数据库相关的操作
class UploadServer {
    // photo表填入数据  (旧版)
    async create(data){
        const statement = 'INSERT INTO photo (filename , mimetype , size, user_id , journal_id) VALUES ? ;'
        const [result] = await connection.query(statement ,[data])
        return result
    }

    async addPhotoServer(data){
        const statement = 'INSERT INTO photo (moment_id , user_id , filename ) VALUES ? ;'
        const [result] = await connection.query(statement ,[data])
        return result
    }
}
module.exports = new UploadServer()